#!/usr/local/bin/python3
# *_* coding: UTF-8 *_*
# @IDE: PyCharm
# @Version: Python3.97
# @Author: Kendrick.Kc
# @Email: 509556985@qq.com
# @File: serializer.py
# @Inst: 这里是模块名描述
# @Time: 2023/5/20 15:26
# -----


from rest_framework import serializers
from basic.models import EmailModel, ProcessNumber, UsersKeyModel


class EmailSerializer(serializers.ModelSerializer):

    class Meta:
        model = EmailModel
        # 序列化的字段
        fields = '__all__'
        # 字段校验条件
        extra_kwargs = {
            'address': {
                'required': True,
                'help_text': '邮箱接收地址'
            }
        }


class UsersKeySerializer(serializers.ModelSerializer):

    class Meta:
        model = UsersKeyModel
        # 序列化的字段
        fields = '__all__'
        # 字段校验条件
        extra_kwargs = {
            'exchange': {
                'required': True,
                'help_text': '查询条件: 交易所名称'
            },
            'strategy': {
                'required': True,
                'help_text': '查询条件: 策略名称'
            },
            'api_key': {
                'required': True,
                'help_text': '更新条件: 交易所ApiKey'
            },
            'secret_key': {
                'required': True,
                'help_text': '更新条件: 交易所SecretKey'
            },
            'passphrase': {
                'required': False,
                'help_text': '更新条件(okx所需): 交易所ApiKey密码'
            }
        }
